<script>
import { domain } from '@/common/domain.js';
export default {
  data() {
    return {
      ui: ''
    };
  },
  computed: {
    // getTheme:function() {
    // 	return this.$store.getters.getTheme;
    // },
  },
  onLaunch: function () {
    console.log('App Launch');
    uni.setStorageSync('isFinger', false);
    if (!uni.getStorageSync('fingerBool')) {
      uni.setStorageSync('fingerBool', 0);
    }
    if (!uni.getStorageSync('isface')) {
      uni.setStorageSync('isface', 0);
    }
    // #ifdef APP-PLUS
    console.log(plus.os.name);
    var osname = plus.os.name;

    uni.removeStorageSync('userInfo');
    const updateManager = uni.getUpdateManager(); //本API返回全局唯一的版本更新管理器对象： updateManager，用于管理小程序更新。
    updateManager.onCheckForUpdate(res => {
      //当向小程序后台请求完新版本信息，进行回调方法
      if (res.hasUpdate) {
        updateManager.onUpdateReady(res => {
          //当新版本下载完成，会进行回调
          uni.showModal({
            title: '更新提示',
            content: '新版本已经准备好，是否重启应用？',
            success(res) {
              if (res.confirm) {
                // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                updateManager.applyUpdate();
              }
            }
          });
        });
        updateManager.onUpdateFailed(res => {
          // 新的版本下载失败
          uni.showModal({
            title: '更新提示',
            content: '检查到有新版本，但下载失败，请检查网络设置',
            success(res) {
              if (res.confirm) {
                // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                updateManager.applyUpdate();
              }
            }
          });
        });
      }
    });
    // #endif
  },
  onShow: function () {
    let ui = uni.getStorageSync('theme') || 'dark';
    this.$store.dispatch('changeTheme', ui);
    uni.setLocale('en');
    if (ui == 'dark') {
      uni.setNavigationBarColor({
        frontColor: '#ffffff',
        backgroundColor: '#111d2f'
      });
      uni.setTabBarStyle({
        color: '#979CA6',
        selectedColor: '#4FCF6B',
        backgroundColor: '#111d2f',
        borderStyle: 'white'
      });
    } else {
      uni.setNavigationBarColor({
        frontColor: '#000000',
        backgroundColor: '#ffffff'
      });
      uni.setTabBarStyle({
        color: '#979CA6',
        selectedColor: '#4FCF6B',
        backgroundColor: '#ffffff',
        borderStyle: 'white'
      });
    }
  },
  onHide: function () {}
};
</script>
<style lang="scss">
@import 'uview-ui/index.scss';
@import '/static/iconfont/iconfont.css';
/*@import "/static/ztcss/ztcss.css";*/
@import '/static/zmzit/zmcss.css';
@import '/static/iconfont/iconfont2.css';
@import url('./common/uni.scss');
@import url('./common/common.scss');
@import url('./common/common_dark.scss');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.bold {
  font-weight: bold;
}
.darksss {
  background: #111d2ffa !important;
  box-shadow: 0 0 24rpx rgba(234, 234, 234, 0) !important;
}
.gray {
  color: #666666;
}

.size20 {
  font-size: 20rpx;
}
.size24 {
  font-size: 24rpx;
}
.size26 {
  font-size: 26rpx;
}
.size28 {
  font-size: 28rpx;
}
.size30 {
  font-size: 3vw;
}
page {
  /* background: #F7F7FB; */
  /* background: #ffffff; */
  height: 100%;
  //background: transparent;
}
.vh100 {
  min-height: 100vh;
}
.status_bar {
  height: 60upx;
  width: 100%;
  background-color: #ffffff;
}
.top_view {
  height: var(--status-bar-height);
  width: 100%;
  position: fixed;
  background-color: #ffffff;
  top: 0;
  z-index: 999;
}

view {
  box-sizing: border-box !important;
}
uni-view {
  box-sizing: border-box;

  line-height: 1.2;
}
.uni-padding-wrap {
  width: 100%;
}
.uni-toast {
  z-index: 10000 !important;
}
.uni-modal__btn {
  color: red !important;
}
uni-tabbar .uni-tabbar__label {
  font-weight: bold;
  font-size: 12px !important;
  /* color: #424a50 !important; */
}
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
